package com.hpjpw.idoapp.controller;

import com.hpjpw.idoapp.service.IDoPersonalMomentService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/ido/app/personalMoment")
public class IDoPersonalMomentController extends BaseController {
    @Autowired
    IDoPersonalMomentService personalMomentService;
    @Autowired
    ISysUserService sysUserService;
    
    /**
     * 查询个人动态列表
     */
    @ApiOperation("查询个人动态列表，可带分页参数：pageNum=1&pageSize=10")
    @GetMapping()
    public TableDataInfo list(){
        startPage();
        Long userId = SecurityUtils.getUserId();
        List<Map<String, Object>> mapList = personalMomentService.personalMomentList(userId);
        return getDataTable(mapList);
    }
    /**
     * 查询个人所评论的动态列表
     */
    @ApiOperation("查询个人评论的动态列表，可带分页参数：pageNum=1&pageSize=10")
    @GetMapping("/momentByComment")
    public TableDataInfo momentByComment(){
        startPage();
        Long userId = SecurityUtils.getUserId();
        List<Map<String, Object>> mapList = personalMomentService.personalCommentMomentList(userId);
        return getDataTable(mapList);
    }
}
